package com.shop.zzh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shop.zzh.entity.ZcVideo;
import com.shop.zzh.mbg.mapper.VideoMapper;
import com.shop.zzh.service.VideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: zzh
 * @description: 实现类
 * @author: zhuzh
 * @create: 2019-12-06 23:04
 **/
@Transactional
@Slf4j
@Service
public class VideoServiceIpml implements VideoService {
	@Autowired
	private VideoMapper videoMapper;
	@Override
	public void insertVideo(ZcVideo video) {
		videoMapper.insertVideo(video);
	}

	@Override
	public PageInfo<ZcVideo> getVideoListData(int pageNum, int pageSize, ZcVideo video) throws Exception{
		PageHelper.startPage(pageNum, pageSize);
		List<ZcVideo> list = videoMapper.selectVideoListById(video);

		PageInfo<ZcVideo> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}
}
